package com.kbt.adapter;


import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

/**
 * Created by GLD on 2015-4-15.
 * <p/>
 * 图片轮播的适配器
 */
public class StartAPPActivityAdapter extends android.support.v4.view.PagerAdapter {
    private Context mcontext;
    private ImageView[] imageViews;

    public StartAPPActivityAdapter(Context context, ImageView[] imageViews) {
        this.mcontext = context;
        this.imageViews = imageViews;

    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }

    @Override
    public int getCount() {
        return imageViews.length;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView((View) object);
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {

        container.addView(imageViews[position]);
        return imageViews[position];
    }
}
